<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body{
            height: 3000px;
        }
        .mask{
            width: 100%;
            height: 100%;
            background-color: rgba(0,0,0,0.5);
            position: fixed;
            top: 0;
            left: 0;
        }
        .login{
            box-sizing: border-box;
            width: 300px;
            /* height: 300px; */
            background-color: #fff;
            position: fixed;
            top: 50%;
            left: 50%;
            /* margin-top: -150px;
            margin-left: -150px; */
            transform: translate(-50%,-50%);

            padding: 40px;
        }
        .login input{
            box-sizing: border-box;
            width: 100%;
            height: 40px;
            outline: none;
            margin-bottom: 20px;
            border: 1px solid #ddd;
        }
        .login input::placeholder{
            font-size: 16px;
            position: relative;
            top:2px
        }

        .login input:focus{
            border: 1px solid red;
        }

        .login .login-button input{
            background-color: tomato;
            border: none;
            color: #fff;
            border-radius: 5px;
            margin: 0;
            cursor: pointer;
        }
        .login .close-button{
            /* display: block; */
            position: absolute;
            width: 30px;
            height: 30px;
            background-color: #ddd;
            right: 2px;
            top: 2px;
            text-align: center;
            line-height: 30px;
            color: #000;
            font-size: 30px;
            cursor: pointer;

        }
    </style>
</head>
<body>
    <a href="">登录</a>
    <a href="">注册</a>

    <!-- 黑色半透明遮罩层 -->
    <div class="mask"></div>

    <!-- 登录 -->
     <div class="login">
        <span class="close-button">×</span>
        <div class="user-name">
            <input type="text" placeholder="用户名">
        </div>
        <div class="user-pwd">
            <input type="password" placeholder="密码">
        </div>

        <div class="login-button">
            <input type="submit" value="登录">
        </div>
     </div>
</body>
</html>